﻿using MediatR;
using S.RBAC.Domain.Model;
using S.RBAC.Infrastructure.Interface;
using S.RBAC.Read.Api.Application.Command.StaffCommand;

namespace S.RBAC.Read.Api.Application.CommandHandlers.StaffHandler
{
    public class StaffGetInfoCommandHandler : IRequestHandler<StaffGetInfoCommand, Staff>
    {
        protected readonly IStaffRepository _staff;

        public StaffGetInfoCommandHandler(IStaffRepository staff)
        {
            _staff = staff;
        }

        public async Task<Staff> Handle(StaffGetInfoCommand request, CancellationToken cancellationToken)
        {
            return await _staff.GetStaffInfo(t => t.EmployeeID == request.EmployeeID);
        }
    }
}
